﻿using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;

namespace HCMS.HttpApi.Site.Filter
{
    /// <summary>
    /// 隐藏 ABP 框架自动生成的 schemas 【过滤器】
    /// </summary>
    public class HideAbpSchemaFilter : ISchemaFilter
    {
        /// <summary>
        /// 过滤器方法
        /// </summary>
        public void Apply(OpenApiSchema schema, SchemaFilterContext context)
        {
            // 隐藏以 "Volo." 开头的 schemas
            context.SchemaRepository.Schemas.RemoveAll(items => items.Key.StartsWith("Volo."));
        }
    }
}
